home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / p4 / p4-1_2b.lha / p4-1.2b / lib / p4_defs.h < prev    next >
C/C++ Source or Header  |  1993-02-06  |  5KB  |  200 lines

  1. struct proc_info {
  2.     int port;
  3.     int switch_port;
  4.     int unix_id;
  5.     int slave_idx;
  6.     int group_id;
  7.     P4BOOL am_rm;
  8.     char host_name[HOSTNAME_LEN];
  9.     char machine_type[16];
  10. };
  11.  
  12. #define NUMAVAILS 8
  13.  
  14. struct p4_avail_buff {
  15.     int size;            /* size of message portion */
  16.     struct p4_msg *buff;
  17. };
  18.  
  19. struct p4_global_data {
  20. #   ifdef SYSV_IPC
  21.     int sysv_num_semids;
  22.     int sysv_semid[P4_MAX_SYSV_SEMIDS];
  23.     int sysv_next_lock;
  24. #   endif
  25.     struct proc_info proctable[P4_MAXPROCS];
  26.     int listener_pid;
  27.     int listener_port;
  28.     P4BOOL local_communication_only;
  29.     int local_slave_count;
  30.     int n_forked_pids;
  31.     char my_host_name[HOSTNAME_LEN];
  32.     struct p4_avail_buff avail_buffs[NUMAVAILS];
  33.     p4_lock_t avail_buffs_lock;
  34.     struct p4_queued_msg *avail_quel;
  35.     p4_lock_t avail_quel_lock;
  36.     struct p4_msg_queue shmem_msg_queues[P4_MAX_MSG_QUEUES];
  37.     int num_in_proctable;
  38.     int num_installed;
  39.     p4_lock_t slave_lock;
  40.     int dest_id[P4_MAXPROCS];
  41.     int listener_fd;
  42.     int max_connections;
  43.     int cube_msgs_out;    /* i860 msgs not yet msgwait'ed on */
  44.     long reference_time;  /* used in p4_initenv and p4_clock */
  45.     int hi_cluster_id;
  46.     int low_cluster_id;
  47.     P4VOID *cluster_shmem;
  48.     p4_barrier_monitor_t cluster_barrier;
  49.     char application_id[12];
  50. } *p4_global;
  51.  
  52.  
  53. struct connection {
  54.     int type;
  55.     int port;
  56.     int switch_port;
  57.     P4BOOL same_data_rep;
  58. };
  59.  
  60. struct local_data {        /* local to each process */
  61.     int listener_fd;
  62.     int my_id;
  63.     int local_commtype;        /* cube or shmem messages */
  64.     struct p4_msg_queue *queued_messages;
  65.     P4BOOL am_bm;
  66.     struct connection *conntab;    /* pointer to array of connections */
  67.     struct p4_procgroup *procgroup;
  68.     int soft_errors;            /* false if errors cause termination */
  69.     char *xdr_buff;
  70.     XDR xdr_enc;
  71.     XDR xdr_dec;
  72. } *p4_local;
  73.  
  74. struct listener_data {
  75.     int listening_fd;
  76.     int slave_fd;
  77. } *listener_info;
  78.  
  79.  
  80. /* this struct is similar to a p4_net_msg_hdr;  note that the sum of
  81.    the sizes of the items up to the *msg is equal to some number of 
  82.    double words, which is important on machines like bfly2 if you 
  83.    receive doubles into the msg area.
  84. */
  85. /* link, orig_len, and pad are for the buffer itself*/
  86. /* next fields are for the current message in the buffer */
  87. struct p4_msg {
  88.     struct p4_msg *link;
  89.     int orig_len;
  90.     int pad;
  91.     int type;                
  92.     int to;
  93.     int from;
  94.     int ack_req;
  95.     int len;
  96.     int msg_id;                /* for i860 messages */
  97.     int data_type;        /* for use by xdr */
  98.     char *msg;    /* variable length array of characters */
  99. };
  100.  
  101. struct p4_net_msg_hdr {
  102.     int msg_type:32;
  103.     int to:32;
  104.     int from:32;
  105.     int ack_req:32;
  106.     int msg_len:32;
  107.     int msg_id:32;        /* for i860 messages */
  108.     int data_type:32;        /* for use by xdr */
  109.     int pad:32;                 /* pad field to word boundary */
  110. };
  111.  
  112. struct net_initial_handshake {
  113.    int pid:32;
  114.    int pad:32;
  115. };
  116.  
  117. struct p4_queued_msg {
  118.     struct p4_msg *qmsg;
  119.     struct p4_queued_msg *next;
  120. };
  121.  
  122.  
  123. /* Messages between a listener and any other non-listener */
  124.  
  125. #define DIE   1
  126. #define SLAVE_DYING   2     /* Unused.  Check for whole data struct. */
  127. #define CONNECTION_REQUEST   3
  128. #define IGNORE_THIS   4
  129.  
  130. struct slave_listener_msg {
  131.     int type:32;
  132.     int from:32;
  133.     int to:32;
  134.     int to_pid:32;
  135.     int lport:32;
  136.     int pad:32;
  137. };
  138.  
  139. /* Messages between the bm and a rm at startup */
  140.  
  141. #define INITIAL_INFO            11
  142. #define REMOTE_LISTENER_INFO    12
  143. #define REMOTE_SLAVE_INFO       13
  144. #define REMOTE_MASTER_INFO      14
  145. #define REMOTE_SLAVE_INFO_END   15
  146. #define PROC_TABLE_ENTRY        16
  147. #define PROC_TABLE_END          17
  148. #define SYNC_MSG                18
  149.  
  150. struct bm_rm_msg {
  151.     int type:32;
  152.  
  153.     /* for INITIAL_INFO */
  154.     int numslaves:32;
  155.     int numinproctab:32;
  156.     int memsize:32;
  157.     int rm_num:32;
  158.     int debug_level:32;
  159.     int logging_flag:32;
  160.  
  161.     /* for REMOTE_LISTENER_INFO */
  162.     int port:32;
  163.  
  164.     /* for REMOTE_SLAVE_INFO and REMOTE_MASTER_INFO */
  165.     int slave_idx:32;
  166.     int slave_pid:32;
  167.     int am_rm:32;
  168.  
  169.     /* for PROC_TABLE_ENTRY */
  170.     int unix_id:32;
  171.     int group_id:32;
  172.     int switch_port:32;
  173.     /* int pad:32;  to keep number of 32 bit quantities even */
  174.     char host_name[HOSTNAME_LEN];
  175.  
  176.     /* also for INITIAL INFO */
  177.     char pgm[128];
  178.     char version[8];
  179.     char outfile[128];
  180.     char application_id[16];
  181.     char machine_type[16];
  182. };
  183.  
  184. #define P4_ACK_REQ_MASK   1     /* Masks define bits set for requests */
  185. #define P4_ACK_REPLY_MASK 2
  186. #define P4_BROADCAST_MASK 4
  187.  
  188. struct p4_brdcst_info_struct {
  189. /*
  190.   This structure is initialized by init_p4_brdcst_info() which
  191.   is automatically called by every global operation
  192. */
  193.   int initialized;             /* True if structure is initialized */
  194.   int up;                      /* Process above me in tree         */
  195.   int left_cluster;            /* Id of left child cluster master  */
  196.   int right_cluster;           /* Id of right child cluster master */
  197.   int left_slave;              /* Id of left child slave           */
  198.   int right_slave;             /* Id of right child slave          */
  199. } p4_brdcst_info;
  200.